#include<stdio.h>
#include<math.h>
int main(){
  int m,i,k,h=0,leap=1;
  for(m=1;m<=20000;m++){
    k=sqrt(m+1);//用来确定循环次数
    for(i=2;i<=k;i++)
       if(m%i==0){
         leap=0;
         break;
       }
       if(leap==1){
       printf("%-4d",m);
       h++;
       if(h%5 ==0)
         printf("\n");
       }
     leap =1;
   }
  printf("\n\nThe Total is %d",h);
}
